package cn.zymall.order.service.impl;

import cn.zymall.common.model.Comment;
import cn.zymall.common.model.HomeBillboards;
import cn.zymall.order.dao.CommentMapper;
import cn.zymall.order.service.CommentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: mall
 * @description: 评论业务实现类
 * @author: YueNiao
 * @email: 1486617253@qq.com
 * @create: 2020-08-25 10:07
 **/
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements CommentService {
	@Autowired
	CommentMapper commentMapper;
	/**
	 * 分页全部查询
	 * @param page
	 * @param rows
	 * @return
	 */
	@Override
	public PageInfo<Comment> findAll(String userId,String status, int page, int rows) {
		PageHelper.startPage(page,rows);
		List<Comment> list=commentMapper.findAll(userId,status);
		PageInfo<Comment> pageaa = new PageInfo<>(list);
		return pageaa;
	}
	/**
	 * 模糊查询全部
	 * @param value
	 * @param page
	 * @param rows
	 * @return
	 */
	@Override
	public PageInfo<Comment> moFindAll(String userId,String status, String value, int page, int rows) {
		PageHelper.startPage(page,rows);
		List<Comment> list=commentMapper.moFindAll(userId,status,value);
		PageInfo<Comment> pageaa = new PageInfo<>(list);
		return pageaa;
	}

	/**
	 * 店铺评论
	 * @param merchantId
	 * @param userId
	 * @param status
	 * @param page
	 * @param rows
	 * @return
	 */
	@Override
	public PageInfo<Comment> merchantFindAll(String merchantId, String userId, String status, int page, int rows) {
		PageHelper.startPage(page,rows);
		List<Comment> list=commentMapper.merchantFindAll(merchantId,userId,status);
		PageInfo<Comment> pageaa = new PageInfo<>(list);
		return pageaa;
	}
	/**
	 * 店铺评论模糊查询
	 * @param merchantId
	 * @param userId
	 * @param status
	 * @param value
	 * @param page
	 * @param rows
	 * @return
	 */
	@Override
	public PageInfo<Comment> moMerchantFindAll(String merchantId, String userId, String status, String value, int page, int rows) {
		PageHelper.startPage(page,rows);
		List<Comment> list=commentMapper.moMerchantFindAll(merchantId,userId,status,value);
		PageInfo<Comment> pageaa = new PageInfo<>(list);
		return pageaa;
	}
}
